// pages/possword/possword.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    o_type:'password',
    o_icon:'icon-icon-test',
    t_type: 'password',
    t_icon: 'icon-icon-test',
  },
  o_swich(){
    var that = this;
    var types = that.data.o_type;
    console.log(types)
    var icon = that.data.o_icon;
    if (types =='password'){
      that.setData({
        o_type:'password',
        o_icon:'icon-xianshikejian'
      })
    }else{
      that.setData({
        o_type: 'text',
        o_icon: 'icon-icon-test'
      })
    }
  },
  t_swich() {
    var that = this;
    var types = that.data.t_type;
    console.log(types)
    var icon = that.data.t_icon;
    if (types == 'password') {
      that.setData({
        t_type: 'text',
        t_icon: 'icon-xianshikejian'
      })
    } else {
      that.setData({
        t_type: 'password',
        t_icon: 'icon-icon-test'
      })
    }
  },
  submit(e) {
    var that = this;
    var possword = e.detail.value.possword;
    var repassword = e.detail.value.repassword;
    if (!possword) {
      wx.showToast({
        title: '密码不能为空',
        icon: 'none'
      })
      return false;
    } else if (!repassword) {
      wx.showToast({
        title: '请再输入密码',
        icon: 'none'
      })
      return false;
    }
    else if (possword != repassword) {
      wx.showToast({
        title: '密码不一致',
        icon: 'none'
      })
      return false;
    } else {
      wx.showToast({
        title: '验证成功，设置密码',
        icon: 'success',
        duration: 1500
      })
      setTimeout(function () {				//确认之后跳转的页面
        wx.navigateTo({
          url: '../login/login',
        })
      }, 1500);
    }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
 
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})